<?php
require './vendor/autoload.php';
use Dotenv\Dotenv;
use Webman\Config;

if (method_exists(Dotenv::class, 'createUnsafeImmutable')) {
  Dotenv::createUnsafeImmutable(run_path())->load();
} else {
  Dotenv::createMutable(run_path())->load();
}
Config::load(config_path());

$db_key = 'connections.'.config('database.default');
$config = [
  "paths" => [
    "migrations" => "database/migrations",
    "seeds"      => "database/seeders"
  ],
  "environments" => [
    "default_migration_table" => "migrations",
    "default_environment"     => "dev",
    "dev" => [
      "adapter" => config('database.'.$db_key.'.driver'),
      "host"    => config('database.'.$db_key.'.host'),
      "name"    => config('database.'.$db_key.'.database'),
      "user"    => config('database.'.$db_key.'.username'),
      "pass"    => config('database.'.$db_key.'.password'),
      "port"    => config('database.'.$db_key.'.port'),
      "charset" => config('database.'.$db_key.'.charset')
    ]
  ]
];
return $config;
